package com.titan.demo.camel.sample.eip.使用choice实现分支.Test03.camel.route;

import org.apache.camel.spring.SpringRouteBuilder;

public class DemoRouteBuilder extends SpringRouteBuilder {

	@Override
	public void configure() throws Exception {
		from("direct:start")
        .choice()
            .when(body().isEqualTo("1"))
            	.log("Processing: 11111111111")
            	.to("direct:start2")
            .when(body().isEqualTo("2"))
            	.log("Processing: 22222222222")
            	.to("direct:start2")
            .otherwise()
            	.log("Processing: 33333333333")
            	.to("direct:start2")
        ;

		from("direct:start2")
    	.choice()
	    	.when().simple("${header[h1]} == 1")
	           	.log("Processing: aaaaaaaa")
	    	.when().simple("${header[h1]} == 2")
	           	.log("Processing: bbbbbb")
			.otherwise()
	           	.log("Processing: cccccccc")
		;
	}

}
